package com.soft.javase.ch12.recursion;

import java.io.File;
import java.io.IOException;

/**
 * @author wangzhisen
 * @Desc TODO
 * @date 2025/5/14
 * 非规律性递归
1.文件递归搜索
2.文件递归删除
 */
public class RecursionDemo2 {
    public static void main(String[] args) {
/*        File file = new File("D:\\temp");
        if(file.isDirectory()){
            delete(file);
        }
    }*/
        //D:\Bin\QQScLauncher.exe
        Runtime runtime = Runtime.getRuntime();
        try {
            runtime.exec("D:\\Bin\\QQScLauncher.exe");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

/*        public static void delete(File file){
        if(file.isDirectory()){
            File[] files = file.listFiles();
            for(File f : files){
                if(f.isDirectory()){
                    delete(f);
                }else if(f.isFile()){
                    if(f.getName().endsWith(".txt")){
                        System.out.println(f.getAbsolutePath()+"已删除！");
                        f.delete();
                    }
                }
            }
        }
    }*/
    }
}
